<template>
  <wf-el-drawer title="员工信息" :visible.sync="visible" size="520px">
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="员工工号：">{{ form.jobNumber }}</el-form-item>
      <div class="org-add-user-drawer-box">
        <div class="org-add-user-drawer-box-label">员工基本信息</div>
        <div class="org-add-user-drawer-box-cont">
          <el-form-item label="员工姓名：">
            {{ form.realName }}
          </el-form-item>
          <el-form-item label="手机号码：">
            {{ form.mobilePhone }}
          </el-form-item>
          <el-form-item label="出生日期：">
            {{ form.birthday }}
          </el-form-item>
          <el-form-item label="性别：">
            {{ ['女', '男'][form.sex] || '未知' }}
          </el-form-item>
          <el-form-item label="所属部门：">
            {{ form.deptName }}
          </el-form-item>
          <el-form-item label="所属岗位：">
            {{ form.position }}
          </el-form-item>
          <el-form-item label="电子邮箱：">
            {{ form.email }}
          </el-form-item>
        </div>
      </div>
      <div class="org-add-user-drawer-box">
        <div class="org-add-user-drawer-box-label">工作信息</div>
        <div class="org-add-user-drawer-box-cont">
          <el-form-item label="企业邮箱：">
            {{ form.enterpriseEmail }}
          </el-form-item>
          <el-form-item label="办公地点：">
            {{ form.officeLocation }}
          </el-form-item>
          <el-form-item label="座机号码：">
            {{ form.telephoneNumber }}
          </el-form-item>
          <el-form-item label="入职时间：">
            {{ form.entryTime }}
          </el-form-item>
          <el-form-item label="员工状态：">
            {{ ['在职', '离职', '注销'][form.useStatus] || '' }}
          </el-form-item>
          <el-form-item label="备注：">
            {{ form.remark }}
          </el-form-item>
        </div>
      </div>
    </el-form>
    <div slot="footer">
      <el-button @click="cancel">取消</el-button>
    </div>
  </wf-el-drawer>
</template>

<script>
  export default {
    data() {
      return {
        visible: false,
        rawData: {
          birthday: '',
          deptId: 0,
          deptName: '',
          email: '',
          enterpriseEmail: '',
          entryTime: '',
          id: 0,
          idCard: '',
          jobNumber: '',
          mobilePhone: '',
          officeLocation: '',
          organizationId: 0,
          position: '',
          realName: '',
          remark: '',
          sex: 1,
          telephoneNumber: '',
          useStatus: 0,
        },
        form: {},
      };
    },
    methods: {
      onOpen(data) {
        this.form = Object.assign({}, this.rawData, data);
        this.visible = true;
      },
      cancel() {
        this.visible = false;
      },
    },
  };
</script>

<style lang="scss" scoped>
  .org-add-user-drawer-box-label {
    margin-bottom: 20px;
    font-weight: bold;
  }
  .org-add-user-drawer-foot {
    border-top: 1px solid #f7f6f9;
    text-align: right;
    padding: 20px 30px;
  }
</style>
